#define	_CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <string>

using namespace std;

struct Stack
{
	char* a;
	int top;
	int capacity;
};

void StackInit(Stack& st)
{
	st.a = nullptr;
	st.top = 0;
	st.capacity = 0;
}

void StackDestory(Stack& st)
{
	free(st.a);
	st.a = nullptr;
	st.top = 0;
	st.capacity = 0;
}

void StackPush(Stack& st, char x)
{
	if (st.top == st.capacity)
	{
		int newCapacity = st.capacity == 0 ? 4 : st.capacity * 2;
		char* tmp = (char*)realloc(st.a, sizeof(char) * newCapacity);
		if (nullptr == tmp)
		{
			return;
		}
		else
		{
			st.a = tmp;
			st.capacity = newCapacity;
		}
	}

	st.a[st.top] = x;
	++st.top;
}

void StackPop(Stack& st)
{
	--st.top;
}

int StackSize(Stack& st)
{
	return st.top;
}

char StackTop(Stack& st)
{
	return st.a[st.top - 1];
}

bool StackEmpty(Stack& st)
{
	return st.top == 0;
}

int isPalindrome(string s, Stack& st)
{
	for (int i = 0; i < s.size() >> 1; ++i)
	{
		StackPush(st, s[i]);
	}

	int j = s.size() >> 1;
	if (s.size() % 2 == 1)
	{
		j += 1;
	}

	for (j ; j < s.size(); ++j)
	{
		char top = StackTop(st);
		StackPop(st);
		if (top != s[j])
		{
			return 0;
		}
	}

	return StackEmpty(st);
}

int main()
{
	Stack st;
	StackInit(st);
	string s;
	cin >> s;

	cout << isPalindrome(s, st);

	StackDestory(st);

	return 0;
}